<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.leruan.aasimp.entity.CarDemioInfo;"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'carBasicInfoDemio.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link rel="stylesheet" type="text/css" href="css/newcar.css">
		
		<script type="text/javascript">
			function brandChange(value){
				var brand = document.getElementById('brand'); 
				var department = document.getElementById('department');
				if(value == 0){
				department.options.length = 1;
				}
				window.location="newcar/carBasicInfoAction_showDemio?brand=" + value + "&department=0";
				
			}
			function departmentChange(value){
				var brand = document.getElementById('brand').value; 
				var department = document.getElementById('department').value;
				window.location="newcar/carBasicInfoAction_showDemio?brand=" + brand + "&department=" + value;
			}
			function init(){
				var brands = document.getElementById('brand').options; 
				var departments = document.getElementById('department').options;
				var brand = "${request.brand}";
				var department = "${request.department}";
				if(brand != ""){
					for(var i=0; i<brands.length; i++){
						if(brands[i].value == brand){
							document.getElementById('brand').options[i].selected=true;
							break;
						}
					}
				}
				if(department != ""){
					for(var i=0; i<departments.length; i++){
						if(departments[i].value == department){
							document.getElementById('department').options[i].selected=true;
							break;
						}
					}
				}
			}
		</script>

	</head>

	<body onload="init();">
		<div id="main">
			<div style="color:blue;margin-left: 10px;margin-bottom: 10px;">
			品牌:&nbsp;&nbsp;<select style="font-size: 14px; text-align: center;" id="brand"
									onchange="brandChange(this.options[this.options.selectedIndex].value);">
									<option value="0" >
										请选择
									</option>
									<s:iterator var='brand' value="#request.brands">
										<option>
											<s:property value="#brand" />
										</option>
									</s:iterator>
								</select>
			&nbsp;&nbsp;车系:&nbsp;&nbsp;<select id="department" style="font-size: 14px; text-align: center;" 
									onchange="departmentChange(this.options[this.options.selectedIndex].value);">
									<option value="0">
										请选择
									</option>
									<s:iterator var='department' value="#request.departments">
										<option>
											<s:property value="#department" />
										</option>
									</s:iterator>
								</select></div>
			<table>
			<%List<CarDemioInfo> carDemioList = (List<CarDemioInfo>)request.getAttribute("carDemioList");
			request.setAttribute("totalSize",carDemioList.size());
			for(int i=0;i<carDemioList.size()/3;i++){ request.setAttribute("i", i*3);%>
				<tr style="padding: 10px;">
					<s:iterator var="demio" value="#request.carDemioList" begin="#request.i" end="#request.i+2">
					<td style="padding: 5px;">
						<div class="imgDiv" onmouseover="this.style.background='#FFE4D2'"
						onmouseout="this.style.background='#FFF'">
							<a href="newcar/carBasicInfoAction_showCarTypeIndex?demioType=${demio.demioType}" rel="nofollow" target="_blank"><img src="${demio.imageAddress}" /></a>
							<a href="newcar/carBasicInfoAction_showCarTypeIndex?demioType=${demio.demioType}" class="a" rel="nofollow" target="_blank"><s:property value="#demio.brand"/>-<s:property value="#demio.department"/></a>
							<br />
							<div class="cinfo_ul" style="text-align: left;">
								<font size="3px" color="black">厂商指导价：</font><span class="price"><s:property value="#demio.directMoney"/>万</span>
								<br />
								优点：<s:property value="#demio.advantage"/>
								<br />
								缺点：<s:property value="#demio.disadvantage"/>
							</div>
						</div>
					</td>
					</s:iterator>
				</tr><% }%>
				<tr style="padding: 10px;">
					<s:iterator var="demio" value="#request.carDemioList" begin="#request.i + 3" end="#request.totalSize - 1">
					<td style="padding: 5px;">
						<div class="imgDiv" onmouseover="this.style.background='#FFE4D2'"
						onmouseout="this.style.background='#FFF'">
							<a href="newcar/carBasicInfoAction_showCarTypeIndex?demioType=${demio.demioType}" rel="nofollow" target="_blank"><img src="${demio.imageAddress}" /></a>
							<a href="newcar/carBasicInfoAction_showCarTypeIndex?demioType=${demio.demioType}" class="a" rel="nofollow" target="_blank"><s:property value="#demio.brand"/>-<s:property value="#demio.department"/></a>
							<br />
							<div class="cinfo_ul" style="text-align: left;">
								<font size="3px" color="black">厂商指导价：</font><span class="price"><s:property value="#demio.directMoney"/>万</span>
								<br />
								优点：<s:property value="#demio.advantage"/>
								<br />
								缺点：<s:property value="#demio.disadvantage"/>
							</div>
						</div>
					</td>
					</s:iterator>
				</tr>
			</table>


		</div>

	</body>
</html>
